<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" template="mainLayout.xhtml">

	<ui:define name="pageContent">
		<h:form id="searchForm">
			<p:focus context="searchForm"/>
			<p:commandButton value="#{resourceBundle['btn.new']}" action="new" />
			<p:fieldset legend="#{resourceBundle['panel.search']}" toggleable="true" collapsed="false">
				<p:panelGrid columns="3">
					<ui:insert name="searchFields" />
					<!-- INSERT SEARCH FIELDS -->
				</p:panelGrid>
				<p:commandButton value="#{resourceBundle['btn.search']}" action="search" update="listTable" />
			</p:fieldset>

			<ui:insert name="listValues" />

			<h:commandLink id="pdf" rendered="true" onblur="$(function(){PrimeFaces.focus(null, 'searchForm');});">
				<p:graphicImage name="pdf.png" library="images" height="32" width="32" title="Exportar a PDF" />
				<p:dataExporter type="pdf" target="listTable" fileName="reporte" preProcessor="#{reportController.preProcessPDF}" />
			</h:commandLink>

			<p:dataTable id="listTable" var="row" value="#{listModel}" paginator="true" rows="10"
				paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" rowsPerPageTemplate="5,10,15"
				emptyMessage="#{resourceBundle['list.noData']}" paginatorAlwaysVisible="true">


				<ui:insert name="searchColumns" />

				<p:column styleClass="actionColumn" exportable="false" width="50">
					<ui:insert name="actionColumns" />
					<p:commandLink action="edit" title="#{resourceBundle['list.header.edit']}" styleClass="ui-icon ui-icon-pencil actionColumnElement" rendered="#{empty modifiable?true:modifiable}">
						<f:setPropertyActionListener target="#{targetObject}" value="#{row}" />
					</p:commandLink>
					<p:commandLink execute="@this" render="@none" oncomplete="confirmation.show()" title="#{resourceBundle['list.header.delete']}" rendered="#{empty modifiable?true:modifiable}" styleClass="ui-icon ui-icon-close actionColumnElement">
						<f:setPropertyActionListener target="#{targetObject}" value="#{row}" />
					</p:commandLink>
				</p:column>
			</p:dataTable>

			<p:dialog id="confirmDialog" message="#{resourceBundle['popup.confirm']}" header="#{resourceBundle['popup.confirm']}" severity="alert" widgetVar="confirmation">

				<p:commandButton id="confirm" value="#{resourceBundle['btn.delete']}" oncomplete="confirmation.hide()" action="delete" update="listTable" />
				<p:commandButton id="decline" value="#{resourceBundle['btn.cancel']}" onclick="confirmation.hide()" type="button" />
			</p:dialog>
		</h:form>

		<ui:insert name="afterForm" />
	</ui:define>
</ui:composition>